package com.ph.demo.io;

import java.io.UnsupportedEncodingException;

/**
 * Created by peng on 2019/5/4.
 *
 * 字节-》字符   解码
 */
public class ContentDecode {

    public static void main(String[] args) throws UnsupportedEncodingException {

        String msg = "生命";

        byte[] datas = msg.getBytes();  //默认使用工程的字符集

        msg = new String(datas,0,datas.length,"UTF8");

        System.out.println(msg);

        //乱码的原因 字节数不够  字符集不正确
    }

}
